<?php
$mod = $_GET['mod'];
$id = isset($_GET['id'])?$_GET['id']:1;
$table = 'home';
$te = find("select * from $table where id='$id'",'single');
$title_add = 'Edit "Home"';
?>

<div class="page-header">
    <div class="pull-left"><?= $title_add ?></div>
    <div class="pull-right"></div>
    <div class="clear"></div>
</div>

<form class="form-horizontal" action="?mod=<?= $mod ?>&act=process&id=<?= $id ?>" role="form" name="frmedit" method="post" enctype="multipart/form-data">
    
    <?php 
    
    echo createField(array(
        'name' => "titlemenu",
        'type' => 'text',
        'value' => $te['titlemenu'],
        'title' => "Menu Title"
    )); 
    
    echo createField(array(
        'name' => "titlemenu_vn",
        'type' => 'text',
        'value' => $te['titlemenu_vn'],
        'title' => "Menu Title (Vietnamese)"
    )); 
    
    echo createField(array(
        'name' => "phone",
        'type' => 'text',
        'value' => $te['phone'],
        'title' => "Phone"
    )); 
    
    echo createField(array(
        'name' => "image1",
        'type' => 'file',
        'folder' => 'home-img',
        'size_x' => 310,
        'size_y' => 180,
        'value' => $te['image1'],
        'title' => "Image 1"
    )); 
    
    echo createField(array(
        'name' => "link1",
        'type' => 'text',
        'value' => $te['link1'],
        'title' => "Link 1"
    )); 
    
    echo createField(array(
        'name' => "image2",
        'type' => 'file',
        'folder' => 'home-img',
        'size_x' => 310,
        'size_y' => 180,
        'value' => $te['image2'],
        'title' => "Image 2"
    )); 
    
    echo createField(array(
        'name' => "link2",
        'type' => 'text',
        'value' => $te['link2'],
        'title' => "Link 2"
    ));
    
    echo createField(array(
        'name' => "image3",
        'type' => 'file',
        'folder' => 'home-img',
        'size_x' => 310,
        'size_y' => 180,
        'value' => $te['image3'],
        'title' => "Image 3"
    )); 
    
    echo createField(array(
        'name' => "link3",
        'type' => 'text',
        'value' => $te['link3'],
        'title' => "Link 3"
    )); 
     
 
    ?>
    
    <div class="form-group">
        <label class="col-sm-3 control-label">Keywords :</label>
        <div class="col-sm-9">
            <textarea name="meta_key" class="form-control" ><?= $te['meta_key'] ?></textarea>
        </div>
    </div>
    
    <div class="form-group">
        <label class="col-sm-3 control-label">Description :</label>
        <div class="col-sm-9">
            <textarea name="meta_des" class="form-control" ><?= $te['meta_des'] ?></textarea>
        </div>
    </div>
    
    <div class="form-group">
        <div class="col-sm-offset-3 col-sm-9">
            <button type="submit" class="btn btn-primary">Save</button>
            <button type="reset" class="btn btn-default">Reset</button>
        </div>
    </div>
    <input type="hidden" name="form_" value="edit">
</form>

